<?php if (!defined('THINK_PATH')) exit();?>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta name="keywords" content="scclui框架">
	<meta name="description" content="scclui为轻量级的网站后台管理系统模版。">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<title>首页</title>
		<script type="text/javascript" src="/HouTaiGuanLiZuiZhong/recycle/Public/common/js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript">
			$(function(){
				$("#one").click(function () {
					var classContent = $(".one").val();
					var url = $('#cl_hid').val();
					var mobileName = $("input[name='mobileName']").val();
					if(classContent==""||mobileName==""){
						alert('请填写完整')
					}else {
						$.get(url, {classContent: classContent, mobileName: mobileName}, function (data) {
							if (data) {
								alert('添加大类成功，请在下面依次填写你的小分类')
								//data作为后台的返回值，为添加的大分类的条数，作为产生文本域的个数
								for (var id = 0; id < data; id++) {
									$('body').append("<textarea class=" + id + " style='width: 200px;height: 60px;resize: none;'></textarea>" +
											"--><button id=" + id + ">添加</button>")
								}
								//每点击一次，a自加一次，并且通过依次点击传入后台
								for (var a = 0; a < data; a++) {
									$("#" + a).click(function () {
										var id = $(this).attr('id');
										var content = $("." + id).val();
										var mobileName = $("input[name='mobileName']").val();
										$.get(url, {id: id, content: content, mobile: mobileName}, function (data) {
											if (data) {
												alert(data)
												$(this).html('已添加');
											} else {
												alert('添加失败');
											}
										})
									})
								}
							}
						})
					}
				})
			})
		</script>
	</head>

	<body>
		请输入评估的手机型号：
		<p><input type="text" name="mobileName" placeholder="手机型号"></p>
		<p>写出此型号评估的大类，用逗号隔开。</p>
		<textarea class="one" cols="30" rows="10" placeholder="例如：机身颜色，外观成色，屏幕外观" style="width: 650px;height: 100px;resize: none;"></textarea>
		<input type="hidden" id="cl_hid" value="<?php echo U('checkMobile');?>">
		<p><button id="one">下一步</button></p>
	</body>
</html>